print(Sys.time())

suppressPackageStartupMessages(library(readr))
suppressPackageStartupMessages(library(plyr))
suppressPackageStartupMessages(library(dplyr))

ira <- list()
for (i in 1:13) {
ira[[i]] <- readr::read_csv(
                  paste0("data/IRAhandle_tweets_",i,".csv"),
                  col_types = cols(.default = col_skip(), account_category = col_character(), tweet_id = col_character(), followers = col_integer(), external_author_id = col_character(), publish_date = col_character())
              )
}
ira <- data.table::rbindlist(ira)

ira$pre_election <- as.integer(as.Date((ira$publish_date), "%m/%d/%Y %H:%M") <= "2016-11-08")

ira_labels <- unique(ira[,c("tweet_id","account_category")])

save(
    ira_labels,
    file="data/labeled_troll_tweets_replicate_psrm.RData"
    )

print(Sys.time())
